Repository navigation
feat(files): uploads that work on Windows, several files and zips, and error details (0.62.0) - #29
Merged
Merged
Conversation
store wrote the upload to a temporary file and renamed it while the file was still open. Windows refuses that rename (Go opens files there without FILE_SHARE_DELETE), so every upload in the Windows desktop app answered 500 "internal error": a .png into a gallery's Files and media property, covers, icons and fonts alike. The file is now closed after Sync, as the backup, import and encrypt paths already do.
The desktop app keeps the server's output only until its window opens, so a 500 afterwards left no line to read. In desktop mode the server now also writes warnings and errors to form-md.log in the data folder, opened after the data folder lock, with the run before kept as form-md.log.1.
Problem and Recover answer through httpx.Internal, which adds data.request_id on every server. The desktop server, which listens on loopback for its owner alone, also adds data.detail with the error text, so the window can say what went wrong instead of only "internal error".
POST /api/files/unzip takes a zip with the same fields as POST /api/files and stores each PNG, JPEG, GIF and WebP inside it through store, judged by its content. Other entries, hidden folders, nested zips and entries over the upload limit are listed as skipped with a reason. Reading is capped per entry, at four times the limit in total and at 500 images. The zip is kept encrypted on disk when at-rest encryption is on and always removed.
The Files and media editor picks several files at once and takes dropped files; a zip is sent to /api/files/unzip and its images are added. Files go one at a time under one toast that counts them, and are added in one change at the end. A toast with details shows a ? that opens a centered What went wrong dialog with the message, code, status, request id, the desktop server's cause, the file and where the log is, with Copy. Cover, icon and avatar upload failures get the same ?.
v0.62.0: uploads work in the Windows desktop app (every upload, a .png into a gallery's Files and media property among them, answered "Internal error."), Files and media takes several files and the images inside a zip, an error toast's ? opens what went wrong, and the desktop server keeps its warnings and errors in form-md.log in the data folder. Also carries the person-only window command and Windows fixes merged since v0.61.1. gofmt, go vet, wikicheck, skillcheck, the TypeScript check, the web build with bundlecheck and go test ./... pass at this commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(files): uploads that work on Windows, several files and zips, and error details (0.62.0)
Summary
storeininternal/files/files.gorenamed the temporary upload while it was still open, and Windows refuses that rename (Go opens files there withoutFILE_SHARE_DELETE). The file is now closed before the rename, as backup, import and encrypt already did.form-md.login the data folder (~/form.md/form-md.log), with the run before it inform-md.log.1. Before, the app dropped the server's output once its window opened, so a 500 left nothing to read.data.request_idon every server. The desktop server alone also sendsdata.detailwith the cause.POST /api/files/unzip: every PNG, JPEG, GIF and WebP inside an uploaded zip is stored as an attachment throughstore, judged by content. Other entries are listed as skipped with a reason. Reading is capped per entry, in total (4x the upload limit) and at 500 images.Commits
Short hashes change when the commits are signed, so they are left out.
Version
v0.62.0 (release commit is last). Bumped: Makefile, internal/app/version.go, web/package.json, web/package-lock.json (both fields), src-tauri/Cargo.toml, src-tauri/Cargo.lock, src-tauri/tauri.conf.json, README badge, .docs/wiki/Home.md and Releases.md, docs/EXTENSIONS.md, and the three HASHOUT_LOG.md headers. The release also carries the fixes merged in #27 and #28 since v0.61.1.
Checks
__MACOSXentry) picked in one file dialog, which allowed several files. All four images were added to the property and the gallery card shows the first as its cover. The toast read "Added 4 files, 2 skipped" and its ? listed both skipped entries.form-md.logheld the same line. A non-desktop server sent the request id only and wrote noform-md.log./api/files/unzipreturns 400 not_a_zip, 400 no_images with skipped, 400 bad_purpose and 401 without a session. No temp file is left behind.Not run: an upload on Windows itself (the cause comes from the code and Go's Windows file sharing mode); a server with at-rest encryption on for the zip route; zips over the size and count caps; the UI under 4x CPU and network throttling.
Merging
Merge with a merge commit so each commit and its signature stays. Do not squash.